#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        //child
        int cnt = 5;
        while (cnt--)
        {
            printf("i am a child process\n");
            sleep(1);
        }
        exit(11);
    }
    else 
    {
        //father;
        int statuc = 0;
        wait(&statuc);
        printf("child process success, exit code: %d, exit single: %d\n", statuc >> 8, statuc & 0x7F);
    }

    return 0;
}
